/*
 * SatPrioritizer.h
 *
 *  Created on: Oct 11, 2014
 *      Authors: Avihay Avitan & Stefan Farcas
 */

#ifndef SATPRIORITIZER_H_
#define SATPRIORITIZER_H_
#include "../Pass/PassVector.h"
#include "../GSLogger/Logger.h"

#include <stddef.h>


namespace PassPrioritizerNameSpace {

using namespace std;
using namespace PassVectorSpace;
using namespace LoggerNameSpace;

/**
 * PassComperator is a class that implements the operator function that is responsible to decide which satellite should be served first
 * note: if there will be any other priority considerations that need to be take, they should be implemented here!
 */
class PassComperator
{
public:
	bool operator()(PassVector * s1 , PassVector * s2)
	{
		if (s2->getPassStartTime() < s1->getPassStartTime())
			return true;

		return false;
	}
};


/**
 * PassPrioritizer implements priority queue of PassVector object, intended to decide which satellite is first to be served
 */
class PassPrioritizer {
public:
	PassPrioritizer();
	virtual ~PassPrioritizer();
	PassVector * getNext();
	bool hasNext();
	int getCount();
	void add(PassVector * satellite);

private:
	priority_queue< PassVector* , vector<PassVector*>, PassComperator >  pq;
	Logger * logger;
} ;

} /* namespace SatPrioritizerNameSpace */

#endif /* SATPRIORITIZER_H_ */
